﻿#include "widget.h"
#include <QPushButton>


Widget::Widget(QWidget *parent)
    : QWidget(parent)
{

    this->resize(600,480);
    btn = new QPushButton("after class",this);
    btn->move(100,100);

    teacher = new Teacher(this);
    student = new Student(this);


    connect(btn,&QPushButton::clicked,teacher,&Teacher::sendSignal);

    /* 根据指针所执行的数据类型，决定所指向的成员函数 (利用函数指针来指向函数地址)*/
    //void (Teacher::*p1)() = Teacher::hungry;
    void (Teacher::*p2)(QString) = Teacher::hungry;

    //void(Student::*q1)() = Student::treating;
    void (Student::*q2)(QString) = Student::treating;

    connect(teacher,p2,student,q2);
}

Widget::~Widget()
{

}
